# 创建视图
from flask import Blueprint
from flask import redirect
from flask import render_template
from flask import session

admin_api = Blueprint('admin_api', __name__, url_prefix='/admin')

from . import views


# 提前判断请求用户是不是管理员
@admin_api.before_request
def before_request():
    is_admin = session.get('is_admin', None)
    if is_admin != 1:
        return render_template('admin/login.html')